package com.tedu.login.controller;

import com.tedu.login.pojo.entity.Product;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


import com.tedu.login.pojo.entity.Product;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/goods")
public class GoodsController {

    private static List<Product> goodsList = new ArrayList<>();

    @GetMapping("/list")
    public List<Product> getProductList() {
        return goodsList;
    }

    @PostMapping("/add")
    public String addProduct(@RequestBody Product product) {
        goodsList.add(product); // 保存商品
        return "添加成功";
    }
}

